package com.king.framework.base.domain.vo;

import com.king.common.utils.text.StringUtils;

/**
 * 分页数据
 * 
 * @author king
 */
public class PageDomain {
	/** 当前记录起始索引 */
	private Integer pageNum;

	/** 每页显示记录数 */
	private Integer pageSize;

	/** 排序列 */
	private String sorts;

//	/** 排序的方向desc或者asc */
//	private String isAsc = "asc";

	/** 分页参数合理化 */
	private Boolean reasonable = true;

	public String getOrderBy() {
		if (StringUtils.isEmpty(sorts)) {
			return "";
		}
		String [] sortsArr = sorts.split("@");
		return StringUtils.toUnderScoreCase(sortsArr[0]) + " " + sortsArr[1];
	}

	public Integer getPageNum() {
		return pageNum;
	}

	public void setPageNum(Integer pageNum) {
		this.pageNum = pageNum;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public String getSorts() {
		return sorts;
	}


	public void setSorts(String sorts) {
		this.sorts = sorts;
	}

	public Boolean getReasonable() {
		if (StringUtils.isNull(reasonable)) {
			return Boolean.TRUE;
		}
		return reasonable;
	}

	public void setReasonable(Boolean reasonable) {
		this.reasonable = reasonable;
	}
}
